home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Adobe Air 1.5 / AdobeAIRInstaller.exe / setup.swf / scripts / mx / skins / halo / ToolTipBorder.as < prev   
Text File  |  2008-10-29  |  4KB  |  124 lines

  1. package mx.skins.halo
  2. {
  3.    import flash.display.Graphics;
  4.    import flash.filters.DropShadowFilter;
  5.    import mx.core.EdgeMetrics;
  6.    import mx.core.mx_internal;
  7.    import mx.graphics.RectangularDropShadow;
  8.    import mx.skins.RectangularBorder;
  9.    
  10.    use namespace mx_internal;
  11.    
  12.    public class ToolTipBorder extends RectangularBorder
  13.    {
  14.       
  15.       mx_internal static const VERSION:String = "3.0.0.0";
  16.        
  17.       
  18.       private var _borderMetrics:EdgeMetrics;
  19.       
  20.       private var dropShadow:RectangularDropShadow;
  21.       
  22.       public function ToolTipBorder()
  23.       {
  24.          super();
  25.       }
  26.       
  27.       override public function get borderMetrics() : EdgeMetrics
  28.       {
  29.          if(_borderMetrics)
  30.          {
  31.             return _borderMetrics;
  32.          }
  33.          var _loc1_:String = getStyle("borderStyle");
  34.          switch(_loc1_)
  35.          {
  36.             case "errorTipRight":
  37.                _borderMetrics = new EdgeMetrics(15,1,3,3);
  38.                break;
  39.             case "errorTipAbove":
  40.                _borderMetrics = new EdgeMetrics(3,1,3,15);
  41.                break;
  42.             case "errorTipBelow":
  43.                _borderMetrics = new EdgeMetrics(3,13,3,3);
  44.                break;
  45.             default:
  46.                _borderMetrics = new EdgeMetrics(3,1,3,3);
  47.          }
  48.          return _borderMetrics;
  49.       }
  50.       
  51.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  52.       {
  53.          super.updateDisplayList(param1,param2);
  54.          var _loc3_:String = getStyle("borderStyle");
  55.          var _loc4_:uint = getStyle("backgroundColor");
  56.          var _loc5_:Number = getStyle("backgroundAlpha");
  57.          var _loc6_:uint = getStyle("borderColor");
  58.          var _loc7_:Number = getStyle("cornerRadius");
  59.          var _loc8_:uint = getStyle("shadowColor");
  60.          var _loc9_:Number = 0.1;
  61.          var _loc10_:Graphics;
  62.          (_loc10_ = graphics).clear();
  63.          filters = [];
  64.          switch(_loc3_)
  65.          {
  66.             case "toolTip":
  67.                drawRoundRect(3,1,param1 - 6,param2 - 4,_loc7_,_loc4_,_loc5_);
  68.                if(!dropShadow)
  69.                {
  70.                   dropShadow = new RectangularDropShadow();
  71.                }
  72.                dropShadow.distance = 3;
  73.                dropShadow.angle = 90;
  74.                dropShadow.color = 0;
  75.                dropShadow.alpha = 0.4;
  76.                dropShadow.tlRadius = _loc7_ + 2;
  77.                dropShadow.trRadius = _loc7_ + 2;
  78.                dropShadow.blRadius = _loc7_ + 2;
  79.                dropShadow.brRadius = _loc7_ + 2;
  80.                dropShadow.drawShadow(graphics,3,0,param1 - 6,param2 - 4);
  81.                break;
  82.             case "errorTipRight":
  83.                drawRoundRect(11,0,param1 - 11,param2 - 2,3,_loc6_,_loc5_);
  84.                _loc10_.beginFill(_loc6_,_loc5_);
  85.                _loc10_.moveTo(11,7);
  86.                _loc10_.lineTo(0,13);
  87.                _loc10_.lineTo(11,19);
  88.                _loc10_.moveTo(11,7);
  89.                _loc10_.endFill();
  90.                filters = [new DropShadowFilter(2,90,0,0.4)];
  91.                break;
  92.             case "errorTipAbove":
  93.                drawRoundRect(0,0,param1,param2 - 13,3,_loc6_,_loc5_);
  94.                _loc10_.beginFill(_loc6_,_loc5_);
  95.                _loc10_.moveTo(9,param2 - 13);
  96.                _loc10_.lineTo(15,param2 - 2);
  97.                _loc10_.lineTo(21,param2 - 13);
  98.                _loc10_.moveTo(9,param2 - 13);
  99.                _loc10_.endFill();
  100.                filters = [new DropShadowFilter(2,90,0,0.4)];
  101.                break;
  102.             case "errorTipBelow":
  103.                drawRoundRect(0,11,param1,param2 - 13,3,_loc6_,_loc5_);
  104.                _loc10_.beginFill(_loc6_,_loc5_);
  105.                _loc10_.moveTo(9,11);
  106.                _loc10_.lineTo(15,0);
  107.                _loc10_.lineTo(21,11);
  108.                _loc10_.moveTo(10,11);
  109.                _loc10_.endFill();
  110.                filters = [new DropShadowFilter(2,90,0,0.4)];
  111.          }
  112.       }
  113.       
  114.       override public function styleChanged(param1:String) : void
  115.       {
  116.          if(param1 == "borderStyle" || param1 == "styleName" || param1 == null)
  117.          {
  118.             _borderMetrics = null;
  119.          }
  120.          invalidateDisplayList();
  121.       }
  122.    }
  123. }
  124.